<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MetricsView
 *
 * @author QuangKhoi
 */
class MetricsView {
    public $model;
    public $filter;
    private $trendLineData;
    private $topSocialPlatformsData;
    public $sentimentData;
    public $geoDistriutionData;
    public $exposureData;
    public $conversationMapData;
    public $topLanguagesData;
    
    public function display($filename) {
        include $filename;
    }
    
    public function __set($_name, $_value) {
        switch($_name) {
            case "trendLineData":
                $final = null;
                foreach($_value as $key=>$value) {
                    if (strpos($value, ';'))
                        $final->$key = explode(";", $value);
                    else
                        $final->$key = $value;
                }
                $this->trendLineData = $final;
                break;
            case "topSocialPlatformsData":
                $final = null;
                foreach($_value as $key=>$value) {
                    if (strpos($value, ";"))
                        $final->$key = explode(";", $value);
                    else
                        $final->$key = $value;
                }
                $this->topSocialPlatformsData = $final;
                break;
            default:
                $this->$_name = $value;
        }
    }
    
    public function __get($_name) {
        return $this->$_name;
    }
}

?>
